import { Component } from '@angular/core';

@Component({
  selector: 'app-fkm',
  templateUrl: './fkm.component.html',
  styleUrls: ['./fkm.component.css']
})
export class FKMComponent {
  ngOnInit() {
    const numRows = 9; // 总行数
    const numCols = 7; // 总列数

    type LetterTemplate = number[][];

    interface Letters {
      [key: string]: LetterTemplate;
    }

    const letters: Letters = {
      F: [
        [1, 1, 1, 1, 1, 1, 1],
        [1, 0, 0, 0, 0, 0, 0],
        [1, 0, 0, 0, 0, 0, 0],
        [1, 1, 1, 1, 1, 0, 0],
        [1, 0, 0, 0, 0, 0, 0],
        [1, 0, 0, 0, 0, 0, 0],
        [1, 0, 0, 0, 0, 0, 0],
        [1, 0, 0, 0, 0, 0, 0],
        [1, 0, 0, 0, 0, 0, 0]
      ],
      K: [
        [1, 0, 0, 0, 1, 0, 0],
        [1, 0, 0, 1, 0, 0, 0],
        [1, 0, 1, 0, 0, 0, 0],
        [1, 1, 0, 0, 0, 0, 0],
        [1, 0, 1, 0, 0, 0, 0],
        [1, 0, 0, 1, 0, 0, 0],
        [1, 0, 0, 0, 1, 0, 0],
        [1, 0, 0, 0, 0, 1, 0],
        [1, 0, 0, 0, 0, 0, 1]
      ],
      M: [
        [1, 0, 0, 0, 0, 0, 1],
        [1, 1, 0, 0, 0, 1, 1],
        [1, 0, 1, 0, 1, 0, 1],
        [1, 0, 0, 1, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 1],
        [1, 0, 0, 0, 0, 0, 1]
      ]
    };

    const lettersOrder: string[] = ['F', 'K', 'M'];

    for (let row = 0; row < numRows; row++) {
      let line = '';

      for (let i = 0; i < lettersOrder.length; i++) {
        const currentLetter = lettersOrder[i];
        const letterTemplate = letters[currentLetter];

        for (let col = 0; col < numCols; col++) {
          line += letterTemplate[row][col] === 1 ? '@' : ' ';
        }

        line += '  '; // 字母间的间隔
      }

      console.log(line);
    }

  }
}
